package com.xmy.solution.controller;

import com.xmy.common.core.controller.BaseController;
import com.xmy.common.core.domain.AjaxResult;
import com.xmy.common.core.page.TableDataInfo;
import com.xmy.solution.domain.Categories;
import com.xmy.solution.domain.dto.solution.SolutionAppResDTO;
import com.xmy.solution.domain.dto.solution.SolutionReqDTO;
import com.xmy.solution.domain.dto.userRecommend.UserRecommendDTO;
import com.xmy.solution.service.IUserRecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.security.PublicKey;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/solution/recommend")
public class UserRecommendController extends BaseController {
    @Autowired
    private IUserRecommendService userRecommendService;

    @GetMapping("/AppList")
    public TableDataInfo appList(@RequestParam Long userId) {
        startPage();
        List<SolutionAppResDTO> list = userRecommendService.selectSolutionAppReqDTOList(userId);
        return getDataTable(list);
    }

    @GetMapping("/keyword")
    public AjaxResult keyWordList(@RequestParam Long userId) {
        List<Categories> list = userRecommendService.selectCategoryListByUserId(userId);
        return success(list);
    }

    @PutMapping("/setKeyword")
    public AjaxResult edit(@RequestBody UserRecommendDTO userRecommendDTO) {
        return toAjax(userRecommendService.updateSolutions(userRecommendDTO));
    }
}
